package ru.pstu.itas.cps.controls;

import java.util.ArrayList;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public class Flag extends ActiveElement implements HasStates {

	ArrayList<Bitmap> imgs = null;

	public Flag(String id, int x, int y, int value) {
		super(id, x, y, value);
		imgs = new ArrayList<Bitmap>();
	}

	@Override
	public void Draw(Canvas canvas) {
		Bitmap i = imgs.get(value);
		Rect srcRect = new Rect(0, 0, i.getWidth(), i.getHeight());
		Rect dstRect = new Rect(x - i.getWidth() / 2, y - i.getHeight() / 2, x + i.getWidth() / 2, y + i.getHeight()
				/ 2);
		canvas.drawBitmap(i, srcRect, dstRect, null);
	}

	public void AddState(Bitmap img) {
		imgs.add(img);
	}

}
